﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageCustomersInfo.aspx.cs" Inherits="WebUI_ManageCustomersInfo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
<div style="text-align: center">
        <br />
        &nbsp;<br />
        <br />
        &nbsp;注册用户信息管理：<asp:GridView ID="UserGridView" runat="server" 
            AutoGenerateColumns="False" 
            CaptionAlign="Top" HorizontalAlign="Center" AllowPaging="True" 
            DataKeyNames="CustomersID" DataSourceID="CustomerSqlDataSource" OnRowDeleting="UserGridView_RowDeleting" OnRowEditing="UserGridView_RowEditing" OnRowUpdating="UserGridView_RowUpdating" OnRowCancelingEdit="UserGridView_RowCancelingEdit" Width="463px" >
            <Columns>
                <asp:BoundField DataField="CustomersID" HeaderText="用户ID" ReadOnly="True"
                    SortExpression="CustomersID" />
                <asp:BoundField DataField="Psw" HeaderText="密码" SortExpression="Psw" />
                <asp:BoundField DataField="Name" HeaderText="名字" SortExpression="Name" />
                <asp:BoundField DataField="Company" HeaderText="公司" SortExpression="Company" />
                <asp:CommandField ShowEditButton="True" />
                <asp:CommandField ShowDeleteButton="True" />
            </Columns>
            <EditRowStyle Wrap="True" />
        </asp:GridView>
        <div style="text-align: justify">
            <div style="width: 557px; height: 100px; text-align: justify">
            添加注册用户信息：<br />
            id:&nbsp;<asp:TextBox ID="customeridTextBox" runat="server"></asp:TextBox>
                &nbsp;
&nbsp;&nbsp; 注意：Id不能重复。<br />
            姓名:<asp:TextBox ID="nameTextBox" runat="server"></asp:TextBox>&nbsp;
            <br />
                公司：<asp:TextBox ID="companyTextBox" runat="server"></asp:TextBox>&nbsp;<br />
            密码：<asp:TextBox ID="pswTextBox" runat="server" TextMode="Password"></asp:TextBox><br />
                &nbsp;
            <asp:Button ID="AddButton" runat="server" onclick="AddButton_Click" Text="添加" /></div>
            <br />
            <br />
            <br />
            &nbsp;</div>
        <br />
    <asp:SqlDataSource ID="CustomerSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:webinfConnectionStringLocalhost %>"
        DeleteCommand="DELETE FROM Customers WHERE (CustomersID = @CustomersID)" SelectCommand="SELECT * FROM [Customers]"
        UpdateCommand="UPDATE Customers SET CustomersID = @CustomersID, Psw = @Psw, Name = @Name, Company = @Company" InsertCommand="INSERT INTO Customers(CustomersID, Psw, Name, Company) VALUES (@CustomersID, @Psw, @Name, @Company)">
        <InsertParameters>
            <asp:ControlParameter ControlID="customeridTextBox" DefaultValue="0" Name="CustomersID"
                PropertyName="Text" />
            <asp:ControlParameter ControlID="pswTextBox" DefaultValue="0" Name="Psw" PropertyName="Text" />
            <asp:ControlParameter ControlID="nameTextBox" DefaultValue="0" Name="Name" PropertyName="Text" />
            <asp:ControlParameter ControlID="companyTextBox" DefaultValue="0" Name="Company"
                PropertyName="Text" />
        </InsertParameters>
    </asp:SqlDataSource>
        <br />
        <br />
        &nbsp;
        </div>
    </form>
</body>
</html>
